import mockApi from "@/api/mockApi";

export default class chargeApi {
  static charges = [
    {id: 1, buildingId: 1, buildingName: '北区1栋', roomId: 1, roomNumber: '301', chargeType: 40, billingCycle: '月度', billingStartDate: '2024-01-01', billingEndDate: '2024-01-31', amount: 32.54, lateFee: '', dueDate: '2020-01-31', paymentDate: '', paymentStatus: 10, createTime: '2024-01-01 12:12:12', modifyTime: '2024-02-02 13:13:13'},
    {id: 2, buildingId: 2, buildingName: '北区1栋', roomId: 2, roomNumber: '402', chargeType: 20, billingCycle: '月度', billingStartDate: '2024-02-01', billingEndDate: '2024-02-29', amount: 43.54, lateFee: 2.36, dueDate: '2021-02-29', paymentDate: '2022-03-15', paymentStatus: 20, createTime: '2024-02-02 12:12:12', modifyTime: '2024-03-03 13:13:13'},
    {id: 3, buildingId: 3, buildingName: '南区1栋', roomId: 3, roomNumber: '503', chargeType: 30, billingCycle: '年度', billingStartDate: '2024-03-01', billingEndDate: '2024-03-31', amount: 54.54, lateFee: '', dueDate: '2022-03-31', paymentDate: '', paymentStatus: 90, createTime: '2024-03-03 12:12:12', modifyTime: '2024-04-04 13:13:13'},
    {id: 4, buildingId: 4, buildingName: '南区2栋', roomId: 4, roomNumber: '604', chargeType: 10, billingCycle: '月度', billingStartDate: '2024-04-01', billingEndDate: '2024-04-30', amount: 65.54, lateFee: 4.58, dueDate: '2023-04-30', paymentDate: '2023-05-27', paymentStatus: 20, createTime: '2024-04-04 12:12:12', modifyTime: '2024-05-05 13:13:13'},
    {id: 5, buildingId: 5, buildingName: '东区1栋', roomId: 5, roomNumber: '604', chargeType: 20, billingCycle: '年度', billingStartDate: '2024-04-01', billingEndDate: '2024-04-30', amount: 65.54, lateFee: 4.58, dueDate: '2022-04-30', paymentDate: '2021-05-27', paymentStatus: 10, createTime: '2024-04-04 12:12:12', modifyTime: '2024-05-05 13:13:13'},
    {id: 6, buildingId: 6, buildingName: '东区2栋', roomId: 6, roomNumber: '604', chargeType: 30, billingCycle: '月度', billingStartDate: '2024-04-01', billingEndDate: '2024-04-30', amount: 65.54, lateFee: 4.58, dueDate: '2021-04-30', paymentDate: '2020-05-27', paymentStatus: 20, createTime: '2024-04-04 12:12:12', modifyTime: '2024-05-05 13:13:13'}
  ]

  static async save (params) {
    console.log('chargeApi save params', params)
    const response = await mockApi.operateSuccessfully()
    return response.data
  }

  static async find (params) {
    console.log('chargeApi find params', params)
    const response = await mockApi.queryPageSuccessfully(chargeApi.charges)
    return response.data
  }

  static async findById (id) {
    console.log('chargeApi findById id', id)
    let target = {}
    for (let a of chargeApi.charges) {
      if (a.id === id) {
        target = a
      }
    }
    const response = await mockApi.queryByIdSuccessfully(target)
    return response.data
  }

  static async del (id) {
    console.log('chargeApi del id', id)
    const response = await mockApi.operateSuccessfully()
    return response.data
  }
}